package com.listener;


import java.util.Map;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;


public class InitListener implements ServletContextListener{

	
	public void contextDestroyed(ServletContextEvent sce) {
		
	}

	public void contextInitialized(ServletContextEvent sce) {
		
		String initparmer=sce.getServletContext().getInitParameter("config");
		String real=sce.getServletContext().getRealPath("/");

		if(initparmer==null){
			
	       initparmer="/WEB-INF/struts-config.xml";		
			
		}
	   Map<String,ActionMapping> map=AnayXML.anay(real+initparmer);
	   sce.getServletContext().setAttribute("struts", map);
		
	}
}
